define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'zhifubao/alipay/index',
                    add_url: 'zhifubao/alipay/add',
                    edit_url: 'zhifubao/alipay/edit',
                    del_url: 'zhifubao/alipay/del',
                    multi_url: 'zhifubao/alipay/multi',
                    table: 'zhifubao',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'admin_id', title: __('Admin_id')},
                        {field: 'IDTypedata', title: __('Idtypedata'), visible:false, searchList: {"三证合一营业执照":__('三证合一营业执照'),"普通营业执照":__('普通营业执照')}},
                        {field: 'IDTypedata_text', title: __('Idtypedata'), operate:false},
                        {field: 'companyname', title: __('Companyname')},
                        {field: 'code', title: __('Code')},
                        {field: 'city', title: __('City')},
                        {field: 'home', title: __('Home')},
                        {field: 'business', title: __('Business')},
                        {field: 'busnissterm', title: __('Busnissterm'), operate:'RANGE', addclass:'datetimerange'},
                        {field: 'images', title: __('Images'), formatter: Table.api.formatter.images},
                        {field: 'name', title: __('Name')},
                        {field: 'identity', title: __('Identity')},
                        {field: 'certificate', title: __('Certificate'), operate:'RANGE', addclass:'datetimerange'},
                        {field: 'upimage', title: __('Upimage'), formatter: Table.api.formatter.image},
                        {field: 'downimage', title: __('Downimage'), formatter: Table.api.formatter.image},
                        {field: 'alipaydata', title: __('Alipaydata'), visible:false, searchList: {"有企业支付宝":__('有企业支付宝'),"无企业支付宝":__('无企业支付宝')}},
                        {field: 'alipaydata_text', title: __('Alipaydata'), operate:false},
                        {field: 'alipayemail', title: __('Alipayemail')},
                        {field: 'bankname', title: __('Bankname')},
                        {field: 'bank', title: __('Bank'), visible:false, searchList: {"one":__('bank one'),"two":__('bank two'),"three":__('bank three'),"four":__('bank four'),"five":__('bank five'),"six":__('bank six'),"seven":__('bank seven'),"eight":__('bank eight'),"nine":__('bank nine'),"ten":__('bank ten')}},
                        {field: 'bank_text', title: __('Bank'), operate:false},
                        {field: 'bankcity', title: __('Bankcity')},
                        {field: 'bankzhiname', title: __('Bankzhiname')},
                        {field: 'companyacount', title: __('Companyacount')},
                        {field: 'type', title: __('Type')},
                        {field: 'Businesszizhikimage', title: __('Businesszizhikimage'), formatter: Table.api.formatter.image},
                        {field: 'site', title: __('Site')},
                        {field: 'nickname', title: __('Nickname')},
                        {field: 'mail', title: __('Mail')},
                        {field: 'mobile', title: __('Mobile')},
                        {field: 'status', title: __('Status'), visible:false, searchList: {"0":__('Status 0'),"1":__('Status 1')}},
                        {field: 'status_text', title: __('Status'), operate:false},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});